package liu.zhi.peng;

import com.sun.jdi.connect.TransportTimeoutException;

import javax.swing.*;
import java.net.SocketTimeoutException;
import java.util.Random;
import java.util.Scanner;
//public class demo10 {
//    public static void main(String[] args)throws Exception{
//        System.out.println(Runtime.getRuntime().availableProcessors());
//        System.out.println(Runtime.getRuntime().maxMemory());
//        System.out.println(Runtime.getRuntime().totalMemory());
//        System.out.println(Runtime.getRuntime().freeMemory());
//        Runtime.getRuntime().exec("notepad");
//        Runtime.getRuntime().exit(0);
//        Scanner sc = new Scanner(System.in);
//        Random ran = new Random();
////        System.out.println(sc.toString());
////        System.out.println(sc);
//        System.out.println(ran.toString());
//        System.out.println(ran);
//        Runtime rc = Runtime.getRuntime();
//        System.out.println(rc.availableProcessors());
//        System.out.println(rc.maxMemory());
//        System.out.println(rc.totalMemory());
//        System.out.println(rc.freeMemory());
//        rc.exec("");
//        Runtime.getRuntime().exit(0);
//        Random ran = new Random();
//        Random ran2 = new Random();
//        System.out.println(ran.equals(ran2));
//        System.out.println(ran.toString());
//        System.out.println(ran);
//        String str = new String();
//
//    }
//}

public class demo10{
    public static void main(String args){

    }
    public static void function1() {
        Scanner console = new Scanner(System.in);
        int price = console.nextInt();
        int cost = 0;
        if(price<100)
        {
            cost =price;
        }
        else if(price>=100&&price<500)
        {
            cost=(int)(price*0.9);
        }
        else if(price>=500&&price<2000)
        {
            cost=(int)(price*0.8);
        }
        else if(price>=2000&&price<5000)
        {
            cost = (int)(price*0.7);
        }
        else if(price>=5000)
        {
            cost = (int)(price*0.6);
        }
        //write your code here......
        System.out.println(cost);
    }
    public static void function2() {
        Scanner scanner = new Scanner(System.in);
        double height = scanner.nextDouble();
        double weight = scanner.nextDouble();
        double st =weight/(height*height);
        if(st<18.5)
            System.out.println("偏瘦");
        else if(st>=18.5&&st<20.9)
            System.out.println("苗条");
        else if(st>=20.9&&st<=24.9)
            System.out.println("适中");
        else if(st>24.9)
            System.out.println("偏胖");
    }
    public static void function3() {
            Scanner scanner = new Scanner(System.in);
            String grade =scanner.next();
            switch(grade)
            {
                case "A":
                    System.out.println("优秀");
                    break;
                case "B":
                    System.out.println("良好");
                    break;
                case "C":
                    System.out.println("及格");
                    break;
                case "D":
                    System.out.println("不及格");
                    break;
                default:
                    System.out.println("未知等级");
            }
    }
    public static void function4() {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.next();
        String emailMatcher="[a-zA-Z0-9]+@[a-zA-Z0-9]+\\.[a-zA-Z0-9]+";
        // System.out.println(str.matches(emailMatcher)?"邮箱格式合法" : "邮箱格式不合法");
        int a=str.indexOf('@');
        int b=str.indexOf(".com");
        if(a>=1&&b>=1&&a<str.length()&&b<str.length()&&a<b)
        {
            System.out.println("邮箱格式合法");
        }
        else
            System.out.println("邮箱格式不合法");
    }
    public static void function5() {
        long a=0;
        long sum=0;
        for(int i=0;i<10;i++)
        {
            a=a*10+9;
            sum+=a;
        }
        System.out.println(sum);
    }
    public static void function6() {
        int count = 0;
        Scanner scanner = new Scanner(System.in);
        while(scanner.nextInt()>0){

            count++;
        }
        System.out.println(count);
    }
    //最小公倍数
    public static int getCM(int m, int n){
        // for(int i=m>n ? m : n;i<=m*n;i++)
        // {
        //     if(i%m==0&&i%n==0)
        //     return i;
        // }
        // return 0;
        int a,b;
        a=m>n ? m : n;
        b=m<n ? m : n;
        int c=9;
        while(c!=0)
        {
            c=a%b;
            a=b;
            b=c;
        }
        return m*n/a;
    }

}